package juc.Future;

import java.util.concurrent.Callable;

/**
 * Created by svenl on 7/18/2017.
 */
public class MyCallable implements Callable {
    /**
     * Computes a result, or throws an exception if unable to do so.
     *
     * @return computed result
     * @throws Exception if unable to compute a result
     */
    @Override
    public Object call() throws Exception {

        int sum = 0;

        for (int i = 0; i < 10; i++) {
            sum += i;
        }
        Thread.sleep( 5000);
        return sum;
    }

}
